Skip to content

Feat/1.3.0 animators - #6

Merged
VMichael1999 merged 14 commits into
mainfrom
feat/1.3.0-animators
Oct 25, 2026
Merged

VMichael1999 merged 14 commits into
mainfrom
feat/1.3.0-animators

Conversation

@VMichael1999

Copy link
Copy Markdown
Owner

No description provided.

Cumulative distances, pointAt/headingAt/slice by distance, and nearest() to
project a position onto the route, optionally within a window around a known
distance so a route that passes twice through a place is not confused.
VehicleTracker puts GPS positions on the route. It searches a window around
the last known distance first, then the whole route, and reports positions
farther than the tolerance as off route without losing the progress.
A move can carry a RouteTarget. The marker then moves by distance along the
route, so it turns at corners and takes its rotation from the route, and a
move that starts mid-way (latestOnly) continues from the distance it is at.
A tracked vehicle has a route. Each position is put on the route (searching a
window around the last known distance first), the marker moves to it, and the
route is drawn as the part travelled and the part remaining, following the
marker as it is shown. followRoute makes the marker take the route between two
positions, consumeRoute and the two RouteStyle values control how it is drawn,
and onOffRoute reports positions beyond the tolerance.

updateMarkers and updatePolylines leave the marker and the lines of a tracked
vehicle alone.
MapAnimationController.polylineAnimation(id) returns a handle with pause(),
resume(), seek(progress), value, a progress stream, onComplete and onCycle.

To make pause and seek possible the polyline animation now always runs on its
own simulation (the same timing as AnimationController.repeat, with or without
a count) that can start from any point in time. onComplete is not called for
animations that repeat forever, and the streams are closed on dispose.
PolylineCodec.decode/encode read and write the Google Encoded Polyline format
(precision 5 or 6), checked against the example of the documentation.
boundsOf gives the box that contains a list of points and replaces the
_getBounds helper of the example app.
PolylineAnimator.animateAll returns every polyline for a frame (by default the
one from animate). The controller draws all of them in one call to the map,
removes the ones an animation stops drawing, and keeps them out of the set the
app manages: updatePolylines does not remove them and removing or replacing
the animated polyline takes its extras away too.
PulseAnimator draws a dimmed copy of the route with a lighter, wider glow
(ID <id>#glow) that travels along it, measured in distance. DashFlowAnimator
simulates moving dashes by cutting the start of the line, and loops by moving a
whole number of dash and gap per cycle. Its limitation (the pattern is in
pixels, the cut in meters) and that it is unchecked on devices is documented.
Every RouteSegment (a fraction of the route by distance, with a color) is a
polyline of its own with the ID <id>#<n>. The animator, if any, is applied to
the whole route as if it were one line: it decides which part is visible and
how opaque, and that part is split among the segments, sharing the points where
they meet.

An animation without duration is now drawn at once, and redrawn when its
polyline changes, which static segmented routes need.
followCamera(CameraFollow) moves the camera after a marker (zoom, tilt, and the
map turned with the vehicle or north up), at most about 10 times per second,
sending the last position when the marker stops. stopFollowingCamera ends it.

The package does not receive map gestures by itself: the app passes
onCameraMoveStarted to GoogleMap and, when the camera had been quiet, the
following stops and CameraFollow.onFollowStopped is called. The movement a
camera update of ours causes is ignored for a moment. How each platform reports
it has not been checked on devices, and this is documented.
pauseInBackground (default true): polyline animations stop when the app goes
to the background and go on from the same place when it comes back; an
animation paused through its handle stays paused. Marker moves are not paused
because they must show the latest positions.

respectReduceMotion (default true): when the system asks to reduce motion
(disableAnimations), polylines are drawn as they are, with
PolylineAnimator.reducedMotionFrame deciding what that means for animations
made of several polylines, and markers and vehicles go to their new position
at once.
Animators table, the DashFlowAnimator limitation, colors by section, the
camera that follows (and why the app has to pass onCameraMoveStarted),
background pausing and reduced motion. Adds tests for RouteStyle and
RouteSegment.
@VMichael1999 VMichael1999 self-assigned this Oct 25, 2026
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 99.00990% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/src/animator/segmented_animator.dart 94.44% 3 Missing ⚠️
lib/src/controllers/camera_follower.dart 94.11% 2 Missing ⚠️
lib/src/controllers/map_animation_controller.dart 99.15% 1 Missing ⚠️
lib/src/utils/polyline_codec.dart 97.43% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@VMichael1999
VMichael1999 merged commit 462383a into main Oct 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants